﻿namespace LeetCodeProject._0001_1000._001_100._71_80._073;

public class Solution
{
    public void SetZeroes(int[][] matrix)
    {
        var rows = new bool[matrix.Length];
        var cols = new bool[matrix[0].Length];
        for (int row = 0; row < matrix.Length; row++)
        {
            for (int col = 0; col < matrix[row].Length; col++)
            {
                if (matrix[row][col] == 0)
                {
                    rows[row] = true;
                    cols[col] = true;
                }
            }
        }

        for (int row = 0; row < rows.Length; row++)
        {
            if (rows[row])
            {
                for (int col = 0; col < matrix[row].Length; col++)
                {
                    matrix[row][col] = 0;
                }
            }
        }

        for (int col = 0; col < cols.Length; col++)
        {
            if (cols[col])
            {
                for (int row = 0; row < matrix.Length; row++)
                {
                    matrix[row][col] = 0;
                }
            }
        }
    }
}